<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no, maximum-scale=1"/>
	<meta content="telephone=no,email=no" name="format-detection" />
	<meta name="apple-mobile-web-app-capable" content="yes" />
	<meta content="yes" name="apple-touch-fullscreen">
	<title>学员信息</title>
	<link rel="stylesheet" type="text/css" href="css/basic.css"/>
	<link rel="stylesheet" type="text/css" href="css/layer.css"/>
	<link rel="stylesheet" type="text/css" href="css/student.css"/>
	<script src="js/jquery-3.1.1.min.js"></script>
	<script src="js/layer.js"></script>
	<script src="js/common.js"></script>
	<script src="js/http.js"></script>
	<script>
		$(function(){

			$('#form').attr('action',url+'liuyan');
			centerinfo();
			getliuyan();
			getlogo();
		})
		function centerinfo(){
			$.ajax({
				url:url+'getstuinfo',
				dataType:'json',
				type:'post',
				async:true,
				data:{
				},
				success:function(result){
					// console.log(result);
					var status = result.status;
					var code = result.code;
					if(status==1&&code=='1000'){
						var data = result.data;
						var username = result.username;
						$('#username').html(username+'个人中心');
						if(data!=null&&data.length!=0){
							var html='';
							for(var i=0;i<data.length;i++){
								html +='<li class="clearfix">'+
										'						<div class="img-box fl">';
								if(data[i]['headimage']!=''){
									html +=		'							<a href="tea-intro.html"><img src="'+domain+'/upload/'+data[i]['headimage']+'"/></a>';
								}else{
									html +=		'							<a href="tea-intro.html"><img src="img/default.jpg"/></a>';
								}
								html +=
										'						</div>'+
										'						<div class="img-intro fr">'+
										'							<p class="title"><a href="tea-intro.html">'+data[i]['xingming']+' </a><span class="price fr">￥'+data[i]['price']+'<i>&nbsp;起</i></span></p>'+
										'							<p>'+data[i]['juzhong']+'</p>'+
										'							<p>'+data[i]['hangdang']+'</p>';
								if(data[i]['danwei']!=''){
									html+='							<p><span class="sure-menu"></span>实名&nbsp;<span class="sure-menu"></span>资质</p>';
								}

								html+=
										'							<a href="javascript:void(0);" class="order-btn" onclick="yuyue('+data[i]['id']+')">预约</a>'+
										'							<a href="javascript:void(0);" class="order-btn" onclick="cancelguanzhu('+data[i]['id']+')">取消关注</a>'+
										'						</div>'+
										'					</li>';
							}
							$('.guanzhu-list').html(html);

						}else{
							$('.guanzhu-list').html('没有关注');
						}
						var yuyueres = result.yuyueres;
						if(yuyueres!=null&&yuyueres.length!=0){
							var html='';
							for(var i=0;i<yuyueres.length;i++){
								html +='<li class="clearfix">'+
										'						<div class="img-box fl">';
								if(yuyueres[i]['headimage']!=''){
									html +=		'							<a href="tea-intro.html"><img src="'+domain+'/upload/'+yuyueres[i]['headimage']+'"/></a>';
								}else{
									html +=		'							<a href="tea-intro.html"><img src="img/default.jpg"/></a>';
								}
								html +=
										'						</div>'+
										'						<div class="img-intro fr">'+
										'							<p class="title"><a href="tea-intro.html">'+yuyueres[i]['xingming']+' </a><span class="price fr">￥'+yuyueres[i]['price']+'<i>&nbsp;起</i></span></p>'+
										'							<p>'+yuyueres[i]['juzhong']+'</p>'+
										'							<p>'+yuyueres[i]['hangdang']+'</p>';
								if(yuyueres[i]['danwei']!=''){
									html+='							<p><span class="sure-menu"></span>实名&nbsp;<span class="sure-menu"></span>资质</p>';
								}

								html+='						</div>'+
										'					</li>';
							}
							$('.yuyue-list').html(html);
						}else{
							$('.yuyue-list').html('没有预约');
						}
					}else if(status==1&&code=='1002') {
						alert('未登录');
						window.history.back();
					}else if(status==1&&code=='1008'){
						alert('已经关注过');
					}else{
						$('.yuyue-list').html('没有预约');
						$('.guanzhu-list').html('没有关注');
					}
				},
				error:function(result){
					console.log(result);
				}
			})

		}
		function yuyue(id){
			layer.open({
				type:10,
				title: ["预约","padding: 10px 30px;height: 30px;line-height: 30px;background: #f7f7f7;border-bottom: 1px solid #cccccc;"],
				content:'<div class="order-box">'+
				'<form action="'+url+'yuyue" method="post">'+
				'<input type="hidden" value="stu" name="type"/><input type="hidden" value="'+id+'" name="techid"/>'+'<p><span>教学方式：</span><select name="teachway"><option value="1">老师上门</option><option value="2">学生上门</option></select></p>'+
				'<p><span>姓名：</span><input type="text" name="stuname" placeholder="请输入姓名" data-require="*" data-tip="请输入姓名"/></p>'+
				'<p><span>手机号：</span><input type="text" name="stuphone" placeholder="请输入手机号" data-require="phone" data-tip="请输入手机号"/></p>'+
				'<input type="submit" value="提交" onclick="return check()"/> '+
				'</form>'+
				'</div>',
				className:"order-pop"
			})
		}
		function cancelguanzhu(id){
			$.ajax({
				url:url+'cancelguanzhu',
				dataType:'json',
				type:'post',
				async:true,
				data:{
					'teachid':id
				},success:function(result){
					var status = result.status;
					var code = result.code;
					if(status==1&&code=='1000')
					{
						alert('取消成功');
						centerinfo();
					}else{
						alert('取消失败');
					}
				},error:function(result){
					console.log(result);
				}
			})

		}
		function getliuyan(){
			$.ajax({
				url:url+'getliuyan',
				dataType:'json',
				type:'post',
				async:true,
				data:{
				},success:function(result){
					var status = result.status;
					var code = result.code;
					if(status==1&&code=='1000')
					{
						var data = result.data;
						var html='';
						if(data!=''&&data.length>0){
							var newDate = new Date();

							for(var i=0;i<data.length;i++){
								newDate.setTime(data[i]['dottime'] * 1000);
								html +='<li>'+
										'						<span style="font-size:20px;color: #23cd77">留言时间：</span><p class="time" >'+newDate.toLocaleDateString()+'</p>'+
										'						<span style="font-size: 20px;color: #23cd77">留言内容：</span><p>'+data[i]['content']+'</p>			'+
										'						<span style="font-size: 20px;color: #23cd77">回复内容：</span><p>'+data[i]['recontent']+'</p>			'+
										'					</li>';
							}
							$('.message-list').html(html);
						}

					}else{
						$('.message-list').html('没有留言');
					}
				},error:function(result){
					console.log(result);
				}
			})

		}
		/**
		 *获取logo图片
		 */
		function getlogo(){
			$.ajax({
				url:url+'getlogo',
				type:'post',
				dataType:'json',
				async:true,
				success:function(result){
					var status = result.status;
					var code = result.code;
					if(status==1&&code=='1000'){
						var data = result.data;
						$('#logo').attr('src',data['log']);
					}
				},
				error:function(result){
					console.log(result);
				}
			})
		}
	</script>
</head>
<body>
<header class="header" >
	<a href="javascript:window.history.back()" class="return-btn" style="text-align: center;"></a><div id="username">学员</div>
</header>
<div id="stu-wrapper">
	<!--学校logo-->
	<div class="item logo-item">
		<!--<div class="stu-title">
            <h1>学校logo</h1>
        </div>-->
		<div class="logo-box1">
			<img src="img/default.jpg" id="logo" style="height:3rem"/>
		</div>
	</div>
	<!--学校logo  end-->
	<!--已经关注的老师-->
	<div class="item">
		<div class="stu-title">
			<h1>已经关注的老师</h1>
		</div>
		<ul class="tea-list guanzhu-list">
			<li class="clearfix">
				<div class="img-box fl">
					<a href="tea-intro.html"><img src="img/default.jpg"/></a>
				</div>
				<div class="img-intro fr">
					<p class="title"><a href="tea-intro.html">某某某 </a><span class="price fr">￥200<i>&nbsp;起</i></span></p>
					<p>京剧</p>
					<p>生行</p>
					<p><span class="sure-menu"></span>实名&nbsp;<span class="sure-menu"></span>资质</p>
					<a href="javascript:void(0);" class="order-btn">预约</a>
				</div>
			</li>
			<li class="clearfix">
				<div class="img-box fl">
					<a href="tea-intro.html"><img src="img/default.jpg"/></a>
				</div>
				<div class="img-intro fr">
					<p class="title"><a href="tea-intro.html">某某某 </a><span class="price fr">￥200<i>&nbsp;起</i></span></p>
					<p>京剧</p>
					<p>生行</p>
					<p><span class="sure-menu"></span>实名&nbsp;<span class="sure-menu"></span>资质</p>
					<a href="javascript:void(0);" class="order-btn">预约</a>
				</div>
			</li>
			<li class="clearfix">
				<div class="img-box fl">
					<a href="tea-intro.html"><img src="img/default.jpg"/></a>
				</div>
				<div class="img-intro fr">
					<p class="title"><a href="tea-intro.html">某某某 </a><span class="price fr">￥200<i>&nbsp;起</i></span></p>
					<p>京剧</p>
					<p>生行</p>
					<p><span class="sure-menu"></span>实名&nbsp;<span class="sure-menu"></span>资质</p>
					<a href="javascript:void(0);" class="order-btn">预约</a>
				</div>
			</li>
		</ul>
	</div>
	<!--已经关注的老师  end-->
	<!--已经预约的老师-->
	<div class="item">
		<div class="stu-title">
			<h1>已经预约成功的老师</h1>
		</div>
		<ul class="tea-list yuyue-list">
			<li class="clearfix">
				<div class="img-box fl">
					<a href="tea-intro.html"><img src="img/default.jpg"/></a>
				</div>
				<div class="img-intro fr">
					<p class="title"><a href="tea-intro.html">某某某 </a><span class="price fr">￥200<i>&nbsp;起</i></span></p>
					<p>京剧</p>
					<p>生行</p>
					<p><span class="sure-menu"></span>实名&nbsp;<span class="sure-menu"></span>资质</p>
				</div>
			</li>
			<li class="clearfix">
				<div class="img-box fl">
					<a href="tea-intro.html"><img src="img/default.jpg"/></a>
				</div>
				<div class="img-intro fr">
					<p class="title"><a href="tea-intro.html">某某某 </a><span class="price fr">￥200<i>&nbsp;起</i></span></p>
					<p>京剧</p>
					<p>生行</p>
					<p><span class="sure-menu"></span>实名&nbsp;<span class="sure-menu"></span>资质</p>
				</div>
			</li>
			<li class="clearfix">
				<div class="img-box fl">
					<a href="tea-intro.html"><img src="img/default.jpg"/></a>
				</div>
				<div class="img-intro fr">
					<p class="title"><a href="tea-intro.html">某某某 </a><span class="price fr">￥200<i>&nbsp;起</i></span></p>
					<p>京剧</p>
					<p>生行</p>
					<p><span class="sure-menu"></span>实名&nbsp;<span class="sure-menu"></span>资质</p>
				</div>
			</li>
		</ul>
	</div>
	<!--已经预约的老师 end-->
	<!--留言板-->
	<div class="item write-item">
		<div class="stu-title">
			<h1>留言板</h1>
		</div>
		<div class="write-box">
			<form action="liuyan" method="post" id="form">
				<textarea  rows="" cols="" placeholder="请写下你的意见" name="content"></textarea>
				<div class="submit-box">
					<input type="submit" value="提交" class="submit"/>
				</div>
			</form>
		</div>
	</div>
	<!--留言板  end-->
	<!--我的消息-->
	<div class="item message-item">
		<div class="stu-title">
			<h1>我的消息</h1>
		</div>
		<ul class="message-list">
			<li>
				<p class="time">2012-12-1</p>
				<p>信息信息</p>
			</li>
			<li>
				<p class="time">2012-12-1</p>
				<p>信息信息信息信息信息信息信息信息信息信息信息信息信息信息信息信息</p>
			</li>
		</ul>
	</div>
	<!--我的消息  end-->
</div>
</body>
</html>
